﻿@using JewererBasic.Models
@model OrderDetail

@{
    ViewBag.Title = "Create New Order";

    var gd = new WebGrid(
            Model.Products,
            canPage: true,
            rowsPerPage: 10,
            selectionFieldName: "selectedRow",
            ajaxUpdateContainerId: "gridContent"
        );
    gd.Pager(WebGridPagerModes.NextPrevious);

    var gdProcesses = new WebGrid(
            Model.Processes,
            canPage: true,
            rowsPerPage: 20,
            selectionFieldName: "selectedRow",
            ajaxUpdateContainerId: "gridContent"
        );
    gdProcesses.Pager(WebGridPagerModes.NextPrevious);
}

<h2>Order Detail: @Model.Order.IdOrder</h2>

@using (Html.BeginForm("Details", "Order", FormMethod.Post))
{
    <fieldset>
        <div>
            <table>
                <tr>
                    <td>
                        <a href="/Order/OrderDetail/@Model.Order.IdOrder">
                            <input type="button" value="DETAIL" />
                        </a>
                    </td>
                    <td>
                        <a href="/Order/Index">
                            <input type="button" value="BACK" />
                        </a>
                    </td>
                </tr>
            </table>
        </div>

        <div>
            <table>
                <tr>
                    <td>
                        <fieldset>
                            <legend>INFORMATION</legend>
                            <div>
                                <table>
                                    <tr>
                                        <td><strong>Order Id:</strong></td>
                                        <td>&nbsp;&nbsp;@Html.DisplayFor(m => m.Order.IdOrder)</td>
                                    </tr>
                                    <tr>
                                        <td><strong>Customer Id:</strong></td>
                                        <td>&nbsp;&nbsp;@Html.DisplayFor(m => m.Order.IdCustomer)</td>
                                    </tr>
                                    <tr>
                                        <td><strong>Start Week:</strong></td>
                                        <td style="width: 270px;">&nbsp;&nbsp;@Html.DisplayFor(m => m.Order.StartWeek)</td>
                                        <td><strong>Finish Week:</strong></td>
                                        <td style="width: 270px;">&nbsp;&nbsp;@Html.DisplayFor(m => m.Order.FinishWeek)</td>
                                    </tr>
                                </table>
                            </div>
                        </fieldset>
                    </td>
                </tr>
                <tr>
                    <td>
                        <fieldset>
                            <legend>PRODUCTs</legend>
                            <div style="width: 700px;">
                                @gd.GetHtml(
                                tableStyle: "table",
                                headerStyle: "head",
                                rowStyle: "row",
                                alternatingRowStyle: "altRow",
                                selectedRowStyle: "selectRow",
                                columns: gd.Columns(
                                gd.Column(header: "Index", format: @<div style="width: 50px; text-align: center;">@item.Index</div>),
                                gd.Column(header: "Product Id", format: @<div style="width: 200px; text-align: center;"><a href="@Url.Action("ExportReportProduct", "Report", new { productId = item.ProductId })">@item.ProductId</a></div>),
                                gd.Column(header: "Kind", format: @<div style="width: 100px; text-align: center;"><span id="spanKindId_@item.Index">@item.Kind</span></div>),
                                gd.Column(header: "Size", format: @<div style="width: 100px; text-align: center;"><span id="spanSize_@item.Index">@item.Size</span></div>),
                                gd.Column(header: "Weight", format: @<div style="width: 100px; text-align: center;"><span id="spanWeight_@item.Index">@item.Weight</span></div>),
                                gd.Column(header: "Quantity", format: @<div style="width: 100px; text-align: center;"><span id="spanQuantity_@item.Index">@item.Quantity</span></div>)
        //gd.Column(header: "Finish", format: @<div style="width: 130px; text-align: center;"><span id="spanFinish_@item.Index">@item.TotalFinish / @item.Quantity</span></div>)
                            ))
                            </div>
                        </fieldset>
                    </td>
                </tr>
                <tr>
                    <td>
                        <fieldset>
                            <legend>PROCESSes</legend>
                            <div style="width: 700px;">
                                @gdProcesses.GetHtml(
                                tableStyle: "table",
                                headerStyle: "head",
                                rowStyle: "row",
                                alternatingRowStyle: "altRow",
                                selectedRowStyle: "selectRow",
                                columns: gdProcesses.Columns(
                                gdProcesses.Column(header: "Name", format: @<div style="width: 250px; text-align: center;">@item.Name</div>),
                                gdProcesses.Column(header: "Waiting", format: @<div style="width: 225px; text-align: center;">@item.Waiting</div>),
                                gdProcesses.Column(header: "Finish", format: @<div style="width: 225px; text-align: center;">@item.Finish</div>)
                            ))
                            </div>
                        </fieldset>
                    </td>
                </tr>
            </table>
        </div>
    </fieldset>
}